<extend name="Public:base"/>

<block name="main">

<div id="yzh-content" class="col-xs-12">
    <div class="main-title">
        <h2>会员组编辑</h2>
    </div>

    <form id="myform" class="form-horizontal" action="{:U('MemberGroup/update')}" method="post">
        <input type="hidden" id="id" name="id" value="{$vo['id']}" />
        <div class="form-group">
            <label class="control-label col-md-2">会员组名</label>
            <div class="col-md-5"><input type="text" name="name" class="form-control" class="input-text"  value="{$vo['name']}" validate="required:true,cn_username:true, minlength:2, maxlength:20"/></div>
        </div>
        <div class="form-group">
            <label class="control-label col-md-2">是否激活</label>
            <div class="col-md-5">
            是<input type="radio" name="status" value="1" <eq name="vo['status']" value="1">checked="checked"</eq> />
            否<input type="radio" name="status" value="0" <eq name="vo['status']" value="0">checked="checked"</eq> />
            </div>
        </div>
        <div class="form-group">
            <label class="control-label col-md-2">描述</label>
            <div class="col-md-5">
            <textarea name="remark" class="form-control">{$vo['remark']}</textarea>
            </div>
        </div>


        <div class="form-actions">
            <INPUT TYPE="submit"  value="{:L('dosubmit')}" class="btn btn-sm btn-primary" >
            <input TYPE="reset"  value="{:L('cancel')}" class="btn btn-sm btn-primary">
        </div>
  </form>
</div>

<script type="text/javascript">

function checknode(obj) {
  var chk = $("input[type='checkbox']");
  var count = chk.length;
  var num = chk.index(obj);
  var level_top = level_bottom =  chk.eq(num).attr('level');

  for (var i=num; i>=0; i--) {
    var le = chk.eq(i).attr('level');
    if(eval(le) < eval(level_top)) {
      chk.eq(i).attr("checked",true);
      var level_top = level_top-1;
    }
  }

  for (var j=num+1; j<count; j++){
    var le = chk.eq(j).attr('level');
    if(chk.eq(num).attr("checked")=='checked') {

      if(eval(le) > eval(level_bottom)) chk.eq(j).attr("checked",true);
      else if(eval(le) == eval(level_bottom)) break;
    }
    else {
      if(eval(le) > eval(level_bottom)) chk.eq(j).attr("checked",false);
      else if(eval(le) == eval(level_bottom)) break;
    }
  }
}
</script>
</block>